package com.tfswx.fljdmxyy.api;

import com.tfswx.fljdmxyy.dto.sjzd.*;
import com.tfswx.fljdmxyy.query.sjzd.FldmQueryParam;
import com.tfswx.fljdmxyy.query.sjzd.FldmQueryResult;
import com.tfswx.fljdmxyy.query.sjzd.FldmlbQueryParam;
import com.tfswx.fljdmxyy.query.sjzd.FldmlbQueryResult;
import com.tfswx.fljdmxyy.service.SjzdService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * 数据字典
 *
 * @Author 陈文佳
 * @Date 2023/03/24
 */
@Api(tags = "数据字典")
@RequestMapping("api/sjzd")
@RestController
public class SjzdController {

    @Resource
    private SjzdService sjzdService;

    @ApiOperation("查询分类代码")
    @PostMapping("/getFldm")
    public FldmGetOutputDTO getFldm(@RequestBody @Validated FldmGetInputDTO dto) {
        return sjzdService.getFldm(dto);
    }

    @ApiOperation("添加分类代码类别")
    @PostMapping("/addFldmlb")
    public FldmlbAddOutputDTO addFldmlb(@RequestBody @Validated FldmlbAddInputDTO dto) {
        return sjzdService.addFldmlb(dto);
    }

    @ApiOperation("获取分类代码类别")
    @PostMapping("/queryFldmlb")
    public List<FldmlbQueryResult> queryFldmlb(@RequestBody @Validated FldmlbQueryParam param) {
        return sjzdService.queryFldmlb(param);
    }

    @ApiOperation("修改分类代码类别")
    @PostMapping("/updateFldmlb")
    public Boolean updateFldmlb(@RequestBody @Validated FldmlbUpdateInputDTO dto) {
        return sjzdService.updateFldmlb(dto);
    }

    @ApiOperation("添加分类代码")
    @PostMapping("/addFldm")
    public FldmAddOutputDTO addFldm(@RequestBody @Validated FldmAddInputDTO dto) {
        return sjzdService.addFldm(dto);
    }

    @ApiOperation("删除分类代码类别")
    @PostMapping("/deleteFldmlb")
    public Boolean deleteFldmlb(@RequestBody @Validated FldmlbDeleteInputDTO dto) {
        return sjzdService.deleteFldmlb(dto);
    }

    @ApiOperation("获取分类代码列表")
    @PostMapping("/queryFldm")
    public List<FldmQueryResult> queryFldm(@RequestBody @Validated FldmQueryParam param) {
        return sjzdService.queryFldm(param);
    }

    @ApiOperation("修改分类代码")
    @PostMapping("/updateFldm")
    public Boolean updateFldm(@RequestBody @Validated FldmUpdateInputDTO dto) {
        return sjzdService.updateFldm(dto);
    }

    @ApiOperation("查询分类代码类别")
    @PostMapping("/getFldmlb")
    public FldmlbGetOutputDTO getFldmlb(@RequestBody @Validated FldmlbGetInputDTO dto) {
        return sjzdService.getFldmlb(dto);
    }

    @ApiOperation("删除分类代码")
    @PostMapping("/deleteFldm")
    public Boolean deleteFldm(@RequestBody @Validated FldmDeleteInputDTO dto) {
        return sjzdService.deleteFldm(dto);
    }
}